package com.leetcode.algorithm.y22.m07.w4;

import java.util.Arrays;

/**
 * 238. 除自身以外数组的乘积
 * 
 * https://leetcode.cn/problems/product-of-array-except-self/
 * 
 * @author jie.deng
 *
 */
class Question0238Solution01 {

	public int[] productExceptSelf(int[] nums) {
		// 超出时间限制
		int len = nums.length;
		int[] arr = new int[len];
		Arrays.fill(arr, 1);
		for (int i = 0; i < len; i++) {
			for (int j = 0; j < len; j++) {
				if (i != j) {
					arr[i] *= nums[j];
				}
			}
		}

		return arr;
	}

}